home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Internet Tools 1993 July / Internet Tools.iso / RockRidge / mail / sendmail / sendmail-5.65c+IDA-1.4.4.1 / ida / aux / RCS / header.c,v < prev    next >
Encoding:
Text File  |  1991-07-01  |  2.9 KB  |  188 lines

  1. head    1.4;
  2. access;
  3. symbols
  4.     RELEASE:1.3;
  5. locks; strict;
  6. comment    @ * @;
  7.  
  8.  
  9. 1.4
  10. date    91.07.01.17.28.32;    author paul;    state Exp;
  11. branches;
  12. next    1.3;
  13.  
  14. 1.3
  15. date    91.06.25.23.50.15;    author paul;    state Exp;
  16. branches;
  17. next    1.2;
  18.  
  19. 1.2
  20. date    91.03.06.18.11.48;    author paul;    state Exp;
  21. branches;
  22. next    1.1;
  23.  
  24. 1.1
  25. date    91.02.19.17.03.50;    author paul;    state Exp;
  26. branches;
  27. next    ;
  28.  
  29.  
  30. desc
  31. @Header munching routines.
  32. @
  33.  
  34.  
  35. 1.4
  36. log
  37. @Replaced most #include statements with a single #include "sendmail.h".
  38. @
  39. text
  40. @/*
  41. **  HEADER -- Header line parser.
  42. **  Copyright (c) 1985 Lennart Lovstrand
  43. **  CIS Dept, Univ of Linkoping, Sweden
  44. **
  45. **  Use it, abuse it, but don't sell it.
  46. **
  47. **  Version of 14-Apr-85.
  48. */
  49.  
  50. #include "sendmail.h"
  51.  
  52. #define HH_CC        "cc"
  53. #define HH_FROM        "from"
  54. #define HH_MESSAGE_ID    "message_id"
  55. #define HH_RETURN_PATH    "return-path"
  56. #define HH_TO        "to"
  57. #define HH_VIA        "via"
  58.  
  59. #define COMMA    ','
  60.  
  61. #define MAKELC(C)    (isupper(C) ? tolower(C) : C)
  62.  
  63. #ifndef lint
  64. static char    Rcsid[] = "@@(#)$Id: header.c,v 1.3 1991/06/25 23:50:15 paul Exp paul $";
  65. #endif /* !lint */
  66.  
  67. #ifdef __STDC__
  68. int iskey(const char *, const char *);
  69. char * eat(char *, int);
  70. char * extract_address(char *, char *);
  71. #else /* !__STDC__ */
  72. # define    const
  73. int iskey();
  74. char * eat();
  75. char * extract_address();
  76. #endif /* __STDC__ */
  77.  
  78. /*
  79.  *    iskey: checks if the line is prefixed by
  80.  *    the supplied keyword (immediately followed by
  81.  *    a colon)
  82.  */
  83. iskey(key, line)
  84.     const char *key, *line;
  85. {
  86.     for (; *key != NULL && *line != NULL; key++, line++)
  87.         if (MAKELC(*key) != MAKELC(*line))
  88.             break;
  89.  
  90.     return *key == NULL && *line == ':';
  91. }
  92.  
  93. char *
  94. eat(str, ch)
  95.     char *str, ch;
  96. {
  97.     for(; *str == ch; str++);
  98.     return str;
  99. }
  100.  
  101. /*
  102.  *    extract_address:
  103.  *    finds and extracts the machine address part of an address field
  104.  */
  105.  
  106. char *
  107. extract_address(field, address)
  108.     char *field, *address;
  109. {
  110.     char *address_start = address;
  111.  
  112.     while(*field && *field != COMMA && *field != '>')
  113.         switch (*field) {
  114.             case '<':
  115.                 return extract_address(field, address_start);
  116.             case '(':
  117.                 while (*field && *field != ')');
  118.                     field++;
  119.                 break;
  120.             case '"':
  121.                 do
  122.                     *address++ = *field++;
  123.                 while (*field && *field != '"');
  124.                 if (*field)
  125.                     *address++ = *field++;
  126.                 break;
  127.             case ' ':
  128.                 *address++ = *field++;
  129.                 field = eat(field, ' ');
  130.                 break;
  131.             case '\\':
  132.                 *address++ = *field++;
  133.                 /* fall through */
  134.             default:
  135.                 *address++ = *field++;
  136.         }
  137.     *address = NULL;
  138.     if (*field)
  139.         return index(field, COMMA)+1;
  140.     else
  141.         return field;
  142. }
  143. @
  144.  
  145.  
  146. 1.3
  147. log
  148. @Added Rcsid[] string.
  149. @
  150. text
  151. @d11 1
  152. a11 5
  153. #include <stdio.h>
  154. #include <sys/types.h>
  155. #include <strings.h>
  156. #include <ctype.h>
  157. #include "useful.h"
  158. d13 6
  159. a18 6
  160. #define H_CC        "cc"
  161. #define H_FROM        "from"
  162. #define H_MESSAGE_ID    "message_id"
  163. #define H_RETURN_PATH    "return-path"
  164. #define H_TO        "to"
  165. #define H_VIA        "via"
  166. d25 1
  167. a25 1
  168. static char    Rcsid[] = "@@(#)$Id$";
  169. @
  170.  
  171.  
  172. 1.2
  173. log
  174. @Added #define const (nothing) to make non-ANSI compilers happy.
  175. @
  176. text
  177. @d28 4
  178. @
  179.  
  180.  
  181. 1.1
  182. log
  183. @Initial revision
  184. @
  185. text
  186. @d33 1
  187. @
  188.